package com.liaoban.app.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.liaoban.app.R;
import com.liaoban.app.api.type.Gift;
import com.liaoban.app.helper.ImageHelper;
import com.liaoban.app.util.CommonUtils;
import com.liaoban.app.util.DateTimeUtils;

import java.util.List;

/**
 * Created by ybc on 2018/7/30 0030.
 * 礼包
 */
public class GiftAdapter extends BaseQuickAdapter<Gift, BaseViewHolder> {

    public GiftAdapter(@Nullable List<Gift> data) {
        super(R.layout.item_gift, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Gift item) {
        ImageView ivSrc = helper.getView(R.id.iv_src);
        ImageHelper.load(ivSrc, CommonUtils.getFullPic(item.getGiftSrc()));
        helper.setText(R.id.tv_name, item.getGiftName());
        helper.setText(R.id.tv_time, DateTimeUtils.formatData(item.getTime() * 1000L, "yyyy-MM-dd"));
    }
}
